/**
 * Created by dale on 2017/10/17.
 */
var targetObj;

$(document).ready(function () {
    var form = new xhForm($('#xh_form'));
    $(".form-date").datetimepicker({format: 'yyyy-mm-dd', language: 'zh-CN', autoclose: true});

    form.parse().bindRequired($('#bt_modal_confirm',parent.document));

    $('#bt_modal_confirm',parent.document).click(function () {
        $("#public").removeAttr("disabled");
        var formData = new FormData($('form')[0]);

        $.ajax({
            url:baseUrl+'short/manage/saveShort',
            data:formData,
            type:'POST',
            contentType: false,
            processData: false,
            success:function (data) {
                window.top.xhTop.closeModal();
                window.top.xhTop.getActiveFrame().noticemsgList.datagrid('reload');
            },
            error:function (data) {
                window.top.swal(
                    data.responseJSON.error,
                    '',
                    'error'
                );
            }
        });

    });
});
